import java.util.*;

/**
 * @author LKQ
 * @date 2022/4/4 22:06
 * @description 侥幸过
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        String[] words = {"a","bb","acd","ace"};
        solution.numMatchingSubseq("abcde", words);
    }
    public int numMatchingSubseq(String s, String[] words) {
        int n = s.length();
        char[] S = s.toCharArray();
        int ans = 0;
        for (String word: words) {
            int p = 0, q = 0;
            char[] w = word.toCharArray();
            while (p < word.length() && q < n) {
                if (w[p] == S[q]) {
                    p++;
                }
                q++;
            }
            if (p == word.length() ) {
                ans++;
            }
        }
        return ans;
    }
}
